package com.example.thirdstage_project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.thirdstage_project.dao.UnitDao;
import com.example.thirdstage_project.entity.Unit;
import com.example.thirdstage_project.entity.User;
import com.example.thirdstage_project.service.UnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UnitServiceImpl extends ServiceImpl<UnitDao, Unit> implements UnitService {

    @Autowired
    private UnitDao unitDao;

    @Override
    public IPage<User> getPage(int currentPage, int pageSize) {
        IPage page = new Page(currentPage,pageSize);
        unitDao.selectPage(page,null);
        return page;
    }

    @Override
    public int selectuid(String password) {
        return  unitDao.selectuid(password);
    }

    @Override
    public boolean updatePassword(String password,int uid) {
        return  unitDao.updatePassword(password,uid)>0;
    }

    @Override
    public List<Unit> select() {
        return unitDao.select();
    }

    @Override
    public String search(String name) {
        return unitDao.search(name);
    }

//    @Override
//    public boolean updateUnit(Unit unit) {
//        return unitDao.updateUnit(unit)>0;
//    }



}
